package com.sctvcloud.renhe.ui.dialog;

import android.app.Dialog;
import android.os.Bundle;
import android.os.Message;
import android.view.View;

import com.ruihang.generalibrary.ui.dialog.BaseDialogFragment;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.renhe.R;

/**
 * Created by Administrator on 2017/6/21 0021.
 */

public class ShotChoiceDiaFragment extends BaseDialogFragment implements View.OnClickListener {
    private CustomFontTextView photo_cv;
    private CustomFontTextView video_cv;
    public static final int PHOTO_TAG = 1;
    public static final int VIDEO_TAG = 2;

    @Override
    protected int getContentRes() {
        return R.layout.dia_shot_choice_fragment;
    }

    @Override
    protected void initViews(Dialog dialog, Bundle savedInstanceState) {
        photo_cv = (CustomFontTextView) dialog.findViewById(R.id.dia_shot_choice_photo);
        video_cv = (CustomFontTextView) dialog.findViewById(R.id.dia_shot_choice_video);
        photo_cv.setOnClickListener(this);
        video_cv.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (callBack != null) {
            Message message = new Message();
            if (v == photo_cv) {
                message.what = PHOTO_TAG;
                dismissAllowingStateLoss();
            } else if (v == video_cv) {
                message.what = VIDEO_TAG;
                dismissAllowingStateLoss();
            }
            callBack.onCallBackMsg(this, message);
        }

    }
}
